
class LoginSystemController {
  def ldapService;
  def index = { redirect(action:login) }
  def login = { }

  def loginJudge = {
    def loginCode = params.loginCode;
    def password = params.password;
    def admin = UserInfo.findByCodeAndPassword(loginCode, password);
    println(admin);
    if (admin != null) {
      session.setAttribute("currentUser", admin);
      redirect(uri:"");
    }else {
      flash.message = "您的登录名或密码不正确";
      render(view: "login");
    }
  }

  def logout = {
      try {
        // session.removeAttribute("adminName");
        session.setAttribute("currentUser", null);
      }
      catch (Exception e) {
        log.error(e,e);
        render "fail";
        return;
      }
    redirect(action:login)
  }
  def popedom = {
    render(view: "noPopedom");    
  }

  def loginUser={

  }

}
